<?php
    /**
     *  Copyright (c) 2013, advert-m102 Team
     *  All rights reserved.
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions are met:
     *   1. Redistributions of source code must retain the above copyright
     *      notice, this list of conditions and the following disclaimer.
     *   2. Redistributions in binary form must reproduce the above copyright
     *      notice, this list of conditions and the following disclaimer in the
     *      documentation and/or other materials provided with the distribution.
     *   3. All advertising materials mentioning features or use of this software
     *      must display the following acknowledgement:
     *      This product includes software developed by the advert-m102.
     *   4. Neither the name of the advert-m102 nor the
     *      names of its contributors may be used to endorse or promote products
     *     derived from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY advert-m102 ''AS IS'' AND ANY
     *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     *  DISCLAIMED. IN NO EVENT SHALL advert-m102 BE LIABLE FOR ANY
     *  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *
     */

    DEFINE ("RUNNING_MODE", "sandbox");

    /**
     *  Cookies
     */
//Index_terms!
    DEFINE ("APP_Version", "0.1");
    DEFINE ("COPYRIGHT", "&copy; Ομάδα 3- m130     2013");
    DEFINE ("AUTHOR", " MSc Web Intelligence , IT TEITHE, Team 3 advert-m102 ");
    DEFINE ("KEYWORDS", " Αγγελίες, Ευκαιρίες, Αγγελίες κοκ, advert-m102 ");
    DEFINE ("DESCRIPTION", "Αγγελίες, Ευκαιρίες, Αγγελίες κοκ , advert-m102");
    DEFINE ("TITLE", " Αγγελίες  advert-m102 ");

    setlocale(LC_ALL, 'el_GR.UTF8');
    date_default_timezone_set('Europe/Athens');

    $_path = dirname(__FILE__);
    $_path = substr($_path, 0, -10); // App/config


    if (RUNNING_MODE == "sandbox") { //   Development phase - sandbox

        DEFINE ("SQL_HOST", "127.0.0.1");
  //      DEFINE ("SQL_BDD", "dsphinx_m102");
   //     DEFINE ("SQL_USER", "mscuser");
   ///     DEFINE ("SQL_PASSWORD", 'enahanyva');
      DEFINE ("SQL_BDD", "MSc_m102");
        DEFINE ("SQL_USER", "MSC_user");
        DEFINE ("SQL_PASSWORD", 'MSC_user1');
        DEFINE ("EMAIL_HOST", 'http://gnu/MSc/Advertisments-m102/');
        DEFINE ("EMAIL_CONTACT", 'dsphinx@gmail.com');
        DEFINE ("HTML_READABLE", TRUE);
        error_reporting(E_ALL);

    } else { //   Live mode - real server

        /**
         *    Security Tip : Hack - Resistant Web App
         *
         *    MySQL User SQL_USER must only have access : SELECT , INSERT, UPDATE, execute stored procedures
         *
         *      UPDATE : to other user ?
         *
         */
        DEFINE ("SQL_HOST", "localhost");
        DEFINE ("SQL_BDD", "");
        DEFINE ("SQL_USER", "");
        DEFINE ("SQL_PASSWORD", '');
        DEFINE ("EMAIL_HOST", 'http://dsphinx.plug.gr/MSc/advert-m102/');
        DEFINE ("EMAIL_CONTACT", 'dsphi@xx.eu');
        DEFINE ("HTML_READABLE", TRUE);         // Echoc.php

        error_reporting(0);
    }


    /*
     *          Session Management   Simple
     *
     *           need secure ?
     */
    if (!defined("__AJAX")) {
        require_once($_path . 'App/Library/Sessions/Sessions.php');
    }

    /*
     *          Paths to include
     */
//update code
    $_SESSION['PATHS'] =
        array(
            "__ROOT__"          => $_path,
            "CONFIG"            => $_path . "App/cfg/config.php",
            "LOGGING_ERRORS_IP" => FALSE, //  Logger::In
            //  TRUE   αργεί λίγο
            "JAVASCRIPT"        => "App/Javascript/",
            "LIBRARIES"         => $_path . "App/Library/",
            "IMAGES"            => "Media/images/",
            "TEMPLATE_DIR"      => "App/Templates/",
            "TOOLS"             => "App/Tools/",
            "LANGUAGE_PATH"     => $_path . "App/Translation/",
            "FILES"             => array( // Loading pages from ...
                "MODULES"                => "Modules/",
                "MEMBERS"                => "Private/", // MEMBERS - OnLY Register User
                "HTML"                   => "Contents/",
                "CONTENTS"               => "Pages/",
                "DEVELOPER"               => "Developer/",
                'TESTING_ONLY_REMOVE_ME' => "TESTING_ONLY/"
            ),
            "SOCIAL_HEADER"     => array( // Social Meta Info Tags on HTML Header
                "TITLE"       => NULL,
                "DESCRIPTION" => KEYWORDS,
                "URL"         => "http://",
                "IMG"         => "http://",
                "FB_APP_ID"   => "324234",
            )
        );


    if (PHP_SAPI === "cli") { //if (!isset($_SERVER['HTTP_HOST'])) {
        trigger_error(' Executing Tests ');
        //die('This script cannot be run from the CLI. Run it from a browser.');
    }

    unset($_path);